export const sleepStandard = time => {
	if(time==0||isNaN(time)||time==undefined){
		return "暂无数据";
	}
	if(time<420){
		return "睡眠较差";
	}else{
		return "睡眠良好"
	}
}
export const temperatureStandard = temp => {
	if(Number(temp)<37.3){
		return "正常";
	}else{
		return "体温异常"
	}
}
export const stepStandard = step => {
	var intStep = Number(step)
	if(intStep<5000){
		return "偏少"
	}else if(intStep<10000){
		return "适中"
	}else if(intStep<20000){
		return "较大"
	}else{
		return "超额"
	}
}
export const bloodStandard = (sbp,dbp) =>{
	// var sbpStandard="",dbpStandard="";
	if(Number(sbp)>90&&Number(sbp)<140&&Number(dbp)>60&&Number(dbp)<90){
		return "正常";
	}else{
		return "血压异常";
	}
	// if(Number(dbp)>=90){
	// 	dbpStandard = "低压偏高"
	// }else if(Number(dbp)<=60){
	// 	dbpStandard = "低压偏低"
	// }
	// if(Number(sbp)>=140){
	// 	sbpStandard = "高压偏高"
	// }else if(Number(sbp)<=90){
	// 	sbpStandard = "高压偏低"
	// }
	// return sbpStandard + dbpStandard;
}
export const heartStandard = haert =>{
	if(Number(haert)>=60&&Number(haert)<=100){
		return "正常";
	}else if(Number(haert)<60){
		return "心率偏低";
	}else{
		return "心率偏高";
	}
}

export const bloodoxygenStandard = bloodoxygen =>{
	if(Number(bloodoxygen)>=95){
		return "正常";
	}else{
		return "血氧偏低";
	}
}

export const repiratoryStandard = repiratory =>{
	if(Number(repiratory)>20){
		return "呼吸率偏高";
	}else if(Number(repiratory)<12){
		return "呼吸率偏低";
	}else{
		return "正常";
	}
}

export const getStatistic = arr => {
	var res = [];
	var sum = eval(arr.join("+"));
	res.push(Math.max.apply(null, arr))
	res.push(Math.min.apply(null, arr))
	res.push(~~(sum / arr.length * 100) / 100)
	return res;
}